﻿using System;

using System.Collections.Generic;
using System.Text;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Microsoft.Practices.TestUtilities
{
	public static class ExtendedAssert
	{
		public delegate void ThrowsDelegate();

		public static Exception Throws<exceptionType>(ThrowsDelegate target)
			where exceptionType : Exception
		{
			try
			{
				target();
				Assert.Fail("No Exception was thrown.");
			}
			catch(exceptionType ex)
			{
				return ex;
			}

			return null;
		}
	}
}
